<#
设置框架模式（原生 PowerShell）
用途：将 FRAMEWORK_STATUS 设为 paired，并提示后续动作。
用法：
  pwsh -File scripts/windows/setup-framework-mode.ps1
#>
param()

$WindowsDir = Split-Path -Parent $PSCommandPath
$ScriptsDir = Split-Path -Parent $WindowsDir
$RepoDir = Split-Path -Parent $ScriptsDir

$cfgDir = Join-Path $RepoDir 'config'
if (!(Test-Path $cfgDir)) { $cfgDir = Join-Path $RepoDir 'config' }
New-Item -ItemType Directory -Force -Path $cfgDir | Out-Null
$envFile = Join-Path $cfgDir 'rules.env'
$raw = ''
if (Test-Path $envFile) { $raw = Get-Content -Raw $envFile }
$raw = ($raw -split "`n") | Where-Object { $_ -notmatch '^(FRAMEWORK_STATUS)=' }
$raw += 'FRAMEWORK_STATUS=paired'
Set-Content -Path $envFile -Value ($raw -join "`n")
Write-Host "FRAMEWORK_STATUS=paired 已设置。可运行：render-rules 或 framework_evolve verify"
exit 0
